import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:getx_demo_2/base/base_container.dart';
import 'package:getx_demo_2/resource/color.dart';
import 'package:getx_demo_2/utils/ex.dart';
import 'logic.dart';

class MainPage extends StatelessWidget {
  final logic = Get.put(MainLogic());
  final state = Get.find<MainLogic>().state;

  @override
  Widget build(BuildContext context) {
    logic.changeTheme();
    return Obx(
      () => BaseContainer(
        statusDark: isDarkMode(),
        color: ThemeColor.g1.value,
        children: [
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(
                "${state.test}${state.n}",
                style: TextStyle(
                  color: ThemeColor.t1.value,
                  fontSize: 24.sp,
                ),
              ),
              ElevatedButton(
                onPressed: logic.launch,
                child: Text(
                  Get.width.toString(),
                  style: TextStyle(
                    color: ThemeColor.t1.value,
                    fontSize: 24.sp,
                  ),
                ),
              ),
            ],
          )
        ],
      ),
    );
  }
}
